//点击确认按钮
document.getElementById('done').addEventListener('tap', function () {
    var userName = document.getElementById('userName').value;
    var password = document.getElementById('password').value;
    //验证输入项是否为空
    if (userName == '') {
        document.getElementById('err-msg').innerHTML = '请输入用户名';
    } else if (password == '') {
        document.getElementById('err-msg').innerHTML = '请输入密码';
    } else {
        /*登录*/
        mui.ajax('/admin/login',{
            data:{
                userName: userName,
                password: password
            },
            type:'get',//HTTP请求类型
            success:function(data){
                if(data.code>=0){
                    location.href="/admin/mallCode";
                }else{
                    mui.alert('用户名或密码错误', '提示', function() {
                        location.href="/admin/toLoginPage";
                    });
                }
            },
            error:function(data){
                console.log('data',data);
            }
        });
    }
})